-
Notifications
You must be signed in to change notification settings - Fork 620
chore: add scripts/gen-semconv-ts.js to help generate semconv.ts files for unstable semconv consts #2669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2669 +/- ##
==========================================
- Coverage 92.46% 92.41% -0.05%
==========================================
Files 171 171
Lines 8150 8150
Branches 1653 1653
==========================================
- Hits 7536 7532 -4
- Misses 614 618 +4 |
pichlermarc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that's pretty cool 🙂
I've tried it out and it seems that it also includes the @experimental note about how breaking changes in the semconv package would affect it. Not sure if it would make sense to replace those with an empty string or something like "generated from experimental semconv". 🤔
Looking at an example (for experimental/packages/web-common): /**
* A unique id to identify a session.
*
* @example "00112233-4455-6677-8899-aabbccddeeff"
*
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
*/
export const ATTR_SESSION_ID = 'session.id';It is still accurate, no? I.e. that it could break in The generated top-comment: /*
* This file contains a copy of unstable semantic convention definitions
* used by this package.
* @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
*/is meant to help give context. I think it could be helpful to the maintainer/reader to know that the const is still experimental in semconv. Thoughts? |
Or even include the semconv version in that sentence. 🤔 |
|
@pichlermarc @dyladan Separate question: the semconv constants have |
Answering myself: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions |
…an build/esnext/... sources in a local npm install. This does a shallow git clone if necessary.
|
Commit c058095 adds the |
Ah, sorry I did not see that one. All good 👍 |
Refs: https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
Now that we've established how we want packages to use unstable semconv definitions, we are starting to get PRs adding a local copy of these: #2664, #2668
It is helpful to script this to: make it faster, encourage a common pattern for these local copies, avoid cut 'n paste errors.
An example run of this (for #2668) looks like this:
It will also warn/error on attempts to put stable semconv exports in there. That looks like this: